package br.com.cqipac.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.interceptor.ServletRequestAware;

import br.com.cqipac.to.Menu;

import com.opensymphony.xwork2.ActionSupport;

public class MenuAction extends ActionSupport  implements
ServletRequestAware  {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private HttpServletRequest request;
	private HttpSession session;
	private List<Menu> menus;
	private Integer codMenuPrincipal;
//	private Menu menu;
	
	
	public String menu(){
		
		this.menus = (List<Menu>)session.getAttribute("menus");
		
		return "sucesso";
		
	}
	
	public String subMenu(){
		
		this.menus = (List<Menu>)session.getAttribute("menus");
		
		codMenuPrincipal = Integer.parseInt(request.getParameter("codMenu"));
		
//		menu = new Menu();
//		menu.setCodMenu(codMenuPrincipal);
		
		
		
		return "sucesso";
	}

	@Override
	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
		this.session = request.getSession();
	}

	public List<Menu> getMenus() {
		return menus;
	}

	public void setMenus(List<Menu> menus) {
		this.menus = menus;
	}

	public Integer getCodMenuPrincipal() {
		return codMenuPrincipal;
	}

	public void setCodMenuPrincipal(Integer codMenuPrincipal) {
		this.codMenuPrincipal = codMenuPrincipal;
	}

//	public Menu getMenu() {
//		return menu;
//	}
//
//	public void setMenu(Menu menu) {
//		this.menu = menu;
//	}


}
